package com.szly.phm.admin.aspectj.enums;
/**
 * 操作行为枚举类
 *
 * @auther: chengjiang
 */
public enum OperationActionEnum {

    SAVE("1001", "添加"),
    DELETE("1002", "删除"),
    UPDATE("1003", "修改"),
    UPDATE_PASSWORD("1004", "修改密码"),
    UPDATE_RESET_PASSWORD("1005", "重置密码"),
    ROLE_ASSIGN_PERMISSION("1006", "角色分配权限"),
    SAVE_CODE_CHECKLIST("1007", "添加二维码与履职清单关联关系"),
    COPY("1008", "复制"),
    LONG("1009", "登录"),
    OTHER("9999", "其它"),
    ;
    private String code;
    private String message;

    OperationActionEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    /**
     * 根据代码获取对应的mesg
     *
     * @auther: chengjiang
     */
    public static String name(String code) {
        OperationActionEnum[] values = OperationActionEnum.values();
        for (OperationActionEnum value : values) {
            if (value.getCode().equals(code)) {
                return value.getMessage();
            }
        }
        return "其他类型";
    }

    /**
     * 根据代码获取枚举
     *
     * @auther: chengjiang
     */
    public static OperationActionEnum getEnumByCode(String code) {
        for (OperationActionEnum oaEnum : OperationActionEnum.values()) {
            if (oaEnum.getCode().equals(code)) {
                return oaEnum;
            }
        }
        return null;
    }

}
